Digital frequency generator

ABSTRACT

Generating a clock signal having a desired frequency is accomplished by generating a pulse each time a stored accumulator value is found to be greater than or equal to a stored trigger value The seored accumulator value is incremented by a first iterative value n (r) until the stored accumulator value is greater than or equal to the stored trigger value. Subsequently, the stored accumulator value is decremented by a second iterative value until the stored accumulator value is less than the stored trigger value. During each iteration incrementing the stored accumulator value, a current frequency of the clock spinal is compared to a desired frequency value, and if the two values are different, the first iterative value (r) is corrected by a predetermined rate over one or more subsequent iterations until the frequency of the generator clock signal corresponds to the detected value of the desired frequency.

TECHNICAL FIELD

The present invention relates to a method and apparatus for generating aclock signal. In this application, the term "clock signal" is defined asa series of periodic signals which may be used to clock any particularelectronic circuit or device at a fixed or variable frequency. Inparticular, the clock signal may be used in the generation of anywaveform, potentially replacing RC and RL circuits, bistables, sweepingfrequency generators, error correcting amplifiers and phase lockedloops.

BACKGROUND ART

The generation of a known frequency is common in many commercialapplications, including radio equipment, mobile phones, two way radios,television and radio frequency tuners. The need for digital control insuch tuners has brought about dedicated phase locked loop integratedcircuits which are expensive. These circuits have limitations as theyhave a predetermined discrete number of frequencies and pre-determinedrange of frequencies which they can generate. Such an arrangement iscommonly seen when tuning a digital car radio where the FM frequencychanges in steps of typically 0.1 MHz over a 20 MHz range.

Frequency control is also used in motor controllers, particularly instepper and DC motor applications where a clock signal controls thespeed of the motor. Varying the frequency of the clock signal controlsthe speed of the rotor. There are many established methods oftranslating the frequency of a clock signal to drive many differenttypes of electrical motors and many commercially available integratedcircuits which perform such translation. Conventional steppercontrollers can typically only produce around 250 differentpredetermined stepping rates so that when the stepping rate needs to bechanged it can only be done in a stepwise fashion. Accordingly, it isimpossible to obtain a smooth change from one stepping rate to another,which is highly desirable in some applications.

DISCLOSURE OF INVENTION

According to a first aspect of the present invention, a method ofgenerating a clock signal having a desired frequency comprises the stepof generating a pulse each time a stored accumulator value is found tobe greater than or equal to a stored trigger value, wherein in a firstloop the stored accumulator value is iteratively incremented by a firstiterative value until the stored accumulator value is greater than orequal to the stored trigger value and subsequently in a second loop thestored accumulator value is decremented by a second iterative valueuntil the stored accumulator value is less than the stored trigger valueand, wherein

during each iteration of the first loop, a current frequency of theclock signal is compared to a desired frequency value and if the twovalues are different, the first iterative value is corrected at apredetermined rate over one or more subsequent iterations until thefrequency of the generated clock signal corresponds to the detectedvalue of the desired frequency.

Preferably, under conditions where the generated clock signal frequencyequals the desired frequency, the first iterative value is set by thevalue of a detected input corresponding to the desired frequency of theclock signal. An iterative increment equal to the detected value of thedesired frequency in Hertz is added to the stored accumulator valueduring each iteration of the first iterative loop. When the desiredfrequency of the clock signal changes, the first iterative value iscorrected at a predetermined rate over one or more subsequent iterationsuntil the frequency of the generated clock signal, and consequently thefirst iterative value, corresponds to the detected value of the desiredfrequency. Accordingly, the frequency of the clock signal is capable ofaccelerating between two frequencies at a predetermined rate withoutmissing any intermediate frequencies. In the context of a stepper motor,this means that the stepping rate can be accelerated in a manner whichapproximates very closely to a continuous function.

Preferably, the second iterative value is set by the stored triggervalue, whereby the stored trigger value is at least that in Hertz of apre-determined interrupt frequency at which the first and seconditerative loops are driven. More preferably, both the stored triggervalue and interrupt frequency are a value 2^(n), where n is a positiveinteger. This simplifies the comparison between the stored trigger valueand the stored accumulator value as the binary value of the storedtrigger value is represented by a single bit in a register being set andexceeding the trigger value is also represented by a single bit beingset. In this case, an iterative decrement equal to the stored triggervalue is subtracted from the stored accumulator value for each iterationof the second iterative loop or if the stored trigger value is 2^(n),then a single bit is cleared in a register. As an alternative, executionof the second loop can be reduced to a single iteration byprecalculating the number of pulses that need to be produced. Forinstance, if the desired frequency is much larger than the storedtrigger value then a precalculation can be carried out automatically todetermine how many pulses need to be produced for each iteration of thefirst loop.

Preferably, the number of iterations needed to change the firstiterative value is determined by a stored accelerator value which isadded to an accelerator-accumulator for each iteration that the firstiterative value and the desired frequency are not exactly equal. In suchan iteration, each time the accelerator-accumulator is greater than orequal to the stored trigger value, the first iterative value isincremented (or decremented for deceleration) by one and theaccelerator-accumulator is reduced by the value of the stored triggervalue. Such an arrangement enables the acceleration rate to becontrolled accurately in real units (Hertz).

Preferably, the stored trigger value and stored accelerator value arevariable. In particular, the stored trigger value may be arranged to besufficiently large in comparison to an expected desired frequency sothat frequencies may be generated which settle very quickly typicallywithin 10 ms. The stored accelerator value may be selected to controlthe rate at which the first iterative value is corrected when thedesired frequency is changed.

According to a second aspect of the present invention, an apparatus forgenerating a clock signal comprises:

means for detecting an input corresponding to the value of a desiredfrequency;

means for generating a pulse each time a stored accumulator value isfound to be greater than or equal to a stored trigger value;

means for controlling a first loop in which the stored accumulator valueis incremented by a first iterative value corresponding to the value ofthe desired frequency until the stored accumulator value is detected tobe greater than or equal to the stored trigger value;

means for controlling a second loop in which the stored accumulatorvalue is decremented by a second iterative value until the storedaccumulator value is detected to be less than the stored trigger value;and,

means for storing an accelerator value and means for storing anaccelerator accumulator value which are used to control a rate of changeof the first iterative value when the means for detecting the inputvalue of the desired frequency detects that the value of the desiredfrequency has changed.

Preferably, the apparatus further comprises a memory for storing thevalue of the desired frequency, the current frequency, the triggervalue, the accumulator value, and the accelerator value. Preferably, theapparatus also comprises means for generating an interrupt signal whichcontrols the speed at which the first and second loops are executed andprocessing means for carrying out the functions of comparing the valueof the stored accumulator value with the stored trigger value,incrementing or decrementing the stored accumulator value and changingthe first iterative value at a predetermined rate when the desiredfrequency changes.

Preferably, the apparatus is implemented on an integrated circuit whichcomprises a pre-programmed microprocessor.

In one preferred implementation, the clock signal generated by themethod and apparatus of the first and second aspects, respectively, ofthe present invention is used to control a stepper motor to providecontinuous acceleration between two stepping rates according to apredetermined velocity profile.

In its simplest form, the present invention can be used to generate arepeated series of pulses at any particular fixed or continuouslyvarying frequency. When coupled with a look-up table or any algorithmwhich generates a waveform, the method of the invention may be used togenerate any desired waveform at any desired frequency. Uses of thepresent invention include motion control, phase locked loop replacement,harmonic tuning of radio frequencies, frequency generators and any otherdevice which depends upon a fixed or varying frequency. The invention isparticularly well suited to governing motor speeds and in particular forcontrolling stepper motors, including full step, half step andmicro-steppers. Similarly, the speed of a DC motor can be regulated withthis method by providing the controlling frequency which governs therotational speed of the armature. As the present invention accuratelyproduces any fixed or changing frequency, it can be used to accelerateand decelerate motors linearly and can be used to perform a series ofsuch motions.

The present invention is very efficient i.e. fast and compact, and canbe implemented very cheaply on commercially available integratedcircuits and embedded controllers.

BRIEF DESCRIPTION OF DRAWINGS

The present invention will now be described in detail with reference tothe accompanying drawings in which:

FIG. 1 shows a micro-controller embodying the present invention;

FIG. 2 is a flow diagram illustrating the method of the presentinvention;

FIGS. 3 to 5 show in an expanded form individual steps in the method ofthe present invention shown in FIG. 2;

FIG. 6 shows a fluid delivery apparatus which includes a stepper motorused to drive a syringe piston;

FIG. 7a shows a graph of the velocity of fluids discharged from twoseparate syringes, each syringe driven by the apparatus shown in FIG. 6and controlled by the frequency generator of the present invention;

FIG. 7b shows a graph of syringe piston displacement for the twoseparate syringes driven by the apparatus shown in FIG. 6;

FIG. 8 presents table 1 which illustrates how the present inventionaccurately produces frequencies with different interrupt frequencyvalues and settles more quickly at higher interrupt frequencies;

FIG. 9 presents table 2 which illustrates how the present inventionaccurately produces frequencies with different interrupt frequencyvalues and settles more quickly at higher interrupt frequencies;

FIG. 10 presents table 3 which illustrates how the present inventionaccurately produces frequencies with different interrupt frequencyvalues and settles more quickly at higher interrupt frequencies;

FIG. 11 presents table 4 which further illustrates how the presentinvention accurately produces frequencies with different interruptfrequency values and settles more quickly at higher interruptfrequencies;

FIG. 12 presents table 5 which further illustrates how the presentinvention accurately produces frequencies with different interruptfrequency values and settles more quickly at higher interruptfrequencies;

FIG. 13 presents table 6 which further illustrates how the presentinvention accurately produces frequencies with different interruptfrequency values and settles more quickly at higher interruptfrequencies;

FIG. 14 presents table 7 which still further illustrates how the presentinvention accurately produces frequencies with different interruptfrequency values and settles more quickly at higher interruptfrequencies;

FIG. 15 presents table 8 which still further illustrates how the presentinvention accurately produces frequencies with different interruptfrequency values and settles more quickly at higher interruptfrequencies;

FIG. 16 presents table 9 which illustrates how acceleration from onefrequency to another is achieved in accordance with the presentinvention; and

FIG. 17 presents table 10 which illustrates how a clock frequency isautomatically changed to achieve a velocity profile in accordance withthe present invention.

DETAILED DESCRIPTION

FIG. 1 shows a dedicated pre-programmed microprocessor 1. Themicroprocessor 1 comprises a number of registers 2 for storing a numberof variables, some of which are pre-set when the processor is switchedon using the power-on reset 3. The stored variables include a storedtrigger value trigger, a stored accumulator value tank, an incrementvalue r, an accelerator value accRate, a desired frequency F_(d), anaccelerator accumulator AccTank and a detected pulse count.

The processor 1 internally generates an interrupt signal using aninterrupt generator 4 which is driven by an external oscillator 5, whichwill be described in detail below.

A pre-programmed unit 6 controls the two loops, described in detailbelow, which are used to operate a square wave pulse generator 7. Inthis example, the pulse generator 7 is used to drive a waveformgenerator 8.

A user interface 9 is provided to control the processor 1 and inparticular, change the values of the stored variables in the register 2.Furthermore, a feedback loop may be provided to monitor the output ofthe pulse generator 7.

FIG. 2 shows a flow diagram of the process carried out by the processor1 when generating a clock signal having a desired frequency.

When the pre-programmed processor 1 is first switched on, the programinitializes the variables trigger, tank AccTank, accRate and r.

Thereafter, in a first loop 10, each time an interrupt signal isgenerated by the interrupt generator 4, the processor 1 checks to see ifthe user has entered a desired frequency and if so, stores this value asthe desired frequency. In this example, the processor 1 is preprogrammedto initialise the variable r, termed the iterative increment, as zeroand so this iterative increment is increased over a number of iterationsin an acceleration routine which is described in detail below withrespect to FIG. 5 of the drawings until the iterative increment equalsthe detected desired frequency. As an alternative, upon initialisation,the processor 1 can instead wait until a desired frequency is detectedand there after preset the iterative increment r to equal the desiredfrequency, so that no initial acceleration of the iterative increment ris required.

The processor 1 subsequently increases the tank value by a value equalto iterative increment r. The processor then compares the tank value andtrigger value and if the tank value is found to be greater than or equalto the trigger value then in a second loop 11, the processor decrementsthe present value of the tank value by the value of the trigger valueand a clock pulse is generated. The pulse counter is incremented by 1and the comparison of the trigger value and tank value is made again. Inthis example, if necessary, the second loop 11 is repeated until thetank value is found to be less than the trigger value. Once the tankvalue is found to be less than the trigger value, the first loop 10starts again, whereby the tank value is iteratively incremented over oneor more cycles of the first loop 10 until the conditioned that tank isgreater than or equal to trigger is again satisfied.

Turning to each box of the flow diagram in FIG. 2 in more detail, the"initialise variables" box 12 is shown in more detail in FIG. 3. In thisexample, upon initialisation, the processor 1 sets the accelerator valueaccRate to be 1 Hz s⁻², the iterative increment value r to be 100 Hz,the tank value and AccTank value to zero and the value trigger to thefrequency of the interrupt signal.

The operation of the "wait for an interrupt" box 13 is illustrated inthe flow diagram of FIG. 4. The entire system is operated at the speedof the interrupt signal which is driven by the external oscillator 5.The system is maintained between interrupts and it is during this periodthat the user can input signals via the user interface 9 to changevariables. The frequency of the interrupt signal can be preset to anyvalue including that of the oscillator 5 enabling frequency synthesisequal to that of the oscillator 5 as every iteration can be executedsimultaneously, or effectively so, through the use of pipelines orequivalent standard techniques.

FIG. 5 shows the operation of the "accelerate (r)" box 14. Whenprocessor 1 detects that the stored value of the desired frequency isdifferent to the current iterative increment value of r of the firstloop 10, the accelerator value accRate is added to anaccelerator-accumulator AccTank. AccTank is subsequently compared to thetrigger value and if it is greater than or equal to the trigger, AccTankis decremented by the value of trigger and r is incremented (ordecremented for deceleration) by one.

During subsequent cycles of the first loop these steps are repeateduntil r equals the desired frequency. In this manner, the process canaccelerate from one frequency to another at a precisely controlled rateset by the accelerator value accRate.

In essence, the present invention depends upon an input frequency, usedtypically as an interrupt, and three variables, namely, trigger, r andtank. The variable trigger is set to the interrupt frequency in Hertzand is usually never changed, the value r is set to the desiredfrequency in Hertz which can be altered at any time and tank is anaccumulator value. Each time there is an interrupt the increment value ris adjusted if the desired frequency is not yet achieved, tank isincremented by the value of r and tank is compared to trigger. If tankis greater than or equal to trigger a pulse is generated and additionalaction may be taken such as taking a step on the stepper motor, alteringthe waveform of a pulse width modulator or altering some other value orphysical setting. Furthermore, internal registers 2 can be used tomaintain cycle counts, step counts, current frequency, actual frequency,and flags indicating if the frequency is changing and other suchinformation.

Each time tank is found to be greater than or equal to trigger, tank isassigned the value of tank-triqqer, which is always positive or zero anda pulse is produced. Likewise, as the value of tank is never cleared,only decreased by trigger, tank always maintains a remainder and willminimise the actual error of frequency generated to less than one periodof the interrupt frequency.

The error of the frequency generated is non-accumulating. If the desiredfrequency is less than or equal to the interrupt frequency then theerror is never more than 1 interrupt clock period. If the desiredfrequency is greater than the interrupt clock frequency, the process issaid to be saturated and bunches pulses before the next interrupt so asto maintain the correct number of pulses each interrupt. While theaverage frequency will be maintained, there may be systems where such atechnique is unacceptable. Other techniques, such as producing two ormore equally spaced pulses each time a system generates a pulse,hardware frequency doublers, or hardware generated delays, may be usedin conjunction with this method. For example, the second loop can bereduced to a single iterative step for cases where the desired frequencyexceeds the trigger value by precalculating the number of pulsesrequired following each iteration of the first loop. However, for mostsystems these techniques are not needed as in practice it is easy tochoose interrupt clock frequencies which are higher than the maximumfrequency desired.

In applications where the interrupts may themselves be interrupted orentirely missed, the process will maintain a correct frequency providedthat the accumulator value is incremented by the iterative increment foreach interrupt that is missed or abbreviated. When the system has timeto completely service the interrupt, pulse bunching corrects anytemporary quiescent errors. The number of missed interrupts can berecorded separately, can be calculated from a comparison with a realtime clock or the entire process can be dependent upon comparison with areal time clock instead of an interrupt.

When this system is used with stepper motors, and particularly withmicro-steppers, saturation has no measurable effect on the motor. Thisis because pulse bunching occurs at frequencies which are much higherthan motors can respond to. Typically, a stepper motor rotor cannotrespond to a change in coil voltage in less than 20 milliseconds due tothe rotors inertia and the reluctance of the copper windings. As inpractice even on relatively slow, low cost integrated circuitssaturation only occurs at frequencies above approximately 10 KHz, theeffect on the motor is invisible. Moreover, when used withmicro-steppers or look-up tables, instead of bunching pulses togetherand rapidly sending a sequential set of values to a motor coil, only thelast value in the set needs to be sent, as the intermediate values haveno effect on the motor. This skipping technique allows for very highfrequencies to control a micro-stepper, without loss of position stepcount or accuracy. The transition from normal operation to saturation isautomatically performed by the process whenever the frequency exceeds asystem dependent limit. The transition is smooth as pulse bunching isused only to maintain the correct average frequency and the uses ofpulse bunching is always minimised.

One advantage of the present invention is that the variables can bealtered while the system is running. By varying the value r eitherdirectly or indirectly through the accelerate loop, the method of thepresent invention will accelerate, maintain and decelerate to anyfrequency up to the implementation dependent maximum and suchinformation as position or frequency can be reported in real time. Therate of acceleration and deceleration can be controlled by altering thevalue accRate which in turn may alter r at each interrupt. Further,different rates for acceleration and deceleration can be achievedthrough the use of separate variables.

Due to the very simple and compact nature of the process, and itsdependence only on a comparison feature and either addition andsubtraction or with a suitable interrupt frequency, a bitset andbitclear feature, the present invention can be implemented by thecheapest and least computationally powerful micro-controllers resultingin very low cost devices. Low cost embedded controllers employing thismethod to control a stepper motor at rates up to 15,625 steps per secondcan be achieved without skipping any frequencies and can be configuredto produce rates up to 31,000 steps per second while skipping everyother frequency. When used with more powerful processors or programmablelogic devices, the maximum error-free frequency increases up to a limitof the device's oscillator frequency. If such a process is made intodedicated silicon, a non-skipping, non-saturation frequency of 15 MHzcan be achieved and frequencies as high as 300 MHz are currentlypossible. The limitation upon frequency is entirely silicon based asevery iteration can be executed concurrently in a single clock cycle.This frequency maximum is. continually increasing and by using moreexotic materials, such as GaAs, this method could currently generatefrequencies in excess of 1 GHz. When this method is used with amicro-controller all that is typically needed to control a stepper-motoris a source clock and power amplifier as the signals needed for full,half or micro-stepping can be generated internally with existingmicro-controllers.

The process can produce fractional frequencies by altering the value oftrigger or by performing an equivalent operation. For example,frequencies with a 0.1 Hz resolution are produced if triccer is set toten times the interrupt frequency instead of the interrupt frequency andr is set to ten times the desired rate. Similarly, this routine can beused with floating-point numbers instead of integers, to producefractional frequencies.

This method can also be used as part of a closed loop system, where aposition-encoder mounted on the motor provides information about themotors position. Such a system is used to verify that the actualposition is in accordance with the internally calculated position, andminimizes any difference.

One major distinguishing feature of the present invention is that incontrast to existing frequency generators, the clock signal frequenciesgenerated in the present invention are independent of the input clockfrequency. Further, the method has the capability to accurately generateevery frequency from 0 to a system dependent maximum and likewisegenerate a linear acceleration rate from 0 to a system dependentmaximum.

Tables 1 to 9 (FIGS. 8-16) illustrate how the method accurately producesfrequencies with different interrupt frequency values and settles morequickly at higher interrupt frequencies. Furthermore, Table 9 shows howthe method accelerates from one frequency to another.

An example of an implementation of the present invention is shown inFIG. 6. A fluid delivery apparatus 15 comprises a stepper motor 16controlled using the frequency generator of the present invention (notshown). The stepper motor 16 rotates a lead-screw 17 via a coupling 18to drive a member 19 up and down a vertical cylindrical post 20. One arm21 of the member 19 is connected to a piston 22 of a syringe 23 whichhas an inlet/outlet 24 at its upper end.

In use, as the syringe piston 22 is returned to its lower position (notshown) a dilutent is allowed to fill the syringe 23. Operating the motor16 in the opposite direction at a desired stepping rate drives thelead-screw assembly and returns the syringe piston 22 upwardly,discharging the fluid through the outlet 24 at a controlled velocity.

A digital diluter comprises two such fluid delivery assemblies 15 andthe purpose is to mix the contents of the two syringes at apredetermined rate to achieve a change in concentration of the mixturei.e. a concentration gradient. Conventional stepper motor controllersare limited as they can only generate a predetermined discrete number offrequencies over a predetermined range. Accordingly, the velocity ofeach syringe piston can only be changed in a rather coarse stepwisefashion which only approximates to a linear velocity profile. Each timethe velocity of the syringe piston steps up or down the flow of fluidfrom the syringe is disturbed thus reducing the accuracy of anymeasurements made with respect to the mixture.

In contrast, the frequency generator of the present invention is capableof accelerating a stepper motor between two stepping rates according toa predetermined velocity profile. FIGS. 7a and 7b show, respectively,graphs of velocity against time for fluid discharged from two syringesand the relative displacement of the pistons of the two syringes.

In this example, a saline sample is to be mixed with a sample of purewater. As shown in FIG. 7a, the stepper motor driving the syringe filledwith saline solution accelerates the syringe piston to discharge fluidat a velocity V₁, whilst the stepper motor driving the syringe filledwith pure water accelerates the syringe piston to discharge fluid at alower velocity V₂.

Once a constant flow rate from each syringe has been established, attime T₁ the stepper controller associated with the saline filled syringedecelerates linearly over a period T₂ -T₁ to a velocity V₂ whilstsimultaneously, the stepper controller associated with the water filledsyringe accelerates linearly to velocity V₁. During this period, thecombined flow rate of the two syringes remains constant. Finally, thetwo syringes are flushed over the period T₃ -T₂.

As illustrated by this example, the frequency generator of the presentinvention can accelerate between any two frequencies in a linear ratherthan stepwise fashion at a rate determined by the user. In practice, theuser pre-programs the system to change frequency after a predeterminedperiod or number of pulses rather than entering a new desired frequencymanually. The rate of change of velocity for a given displacement isdetermined by the variable accurate (see FIG. 5).

Table 10 (FIG. 17) shows an example of how a pre-programmedmicroprocessor can automatically change a clock signal frequency toachieve the type of velocity profile shown in FIG. 7a. In this example,the frequency remains constant for the first 3000 clock pulses at 100 Hzwhereupon the desired frequency changes to 9 KHz and the rate, r, orfirst iterative increment, accelerates from 100 Hz to 9 KHz over aperiod of around 20 seconds or 42000 pulses.

We claim:
 1. A method of generating a clock signal having a desiredfrequency comprising the step of generating a pulse each time a storedaccumulator value is found to be greater than or equal to a storedtrigger value, wherein in a first loop the stored accumulator value isiteratively incremented by a first iterative value until the storedaccumulator value is greater than or equal to the stored trigger valueand subsequently in a second loop the stored accumulator value isdecremented by a second iterative value until the stored accumulatorvalue is less than the stored trigger value, and wherein during eachiteration of the first loop, a current frequency of the clock signal iscompared to a desired frequency value and if the two values aredifferent, the first iterative value is corrected at a predeterminedrate over one or more subsequent iterations until the frequency of thegenerated clock signal corresponds to the detected value of the desiredfrequency.
 2. A method according to claim 1, in which under conditionswhere the generated clock signal frequency equals the desired frequency,the first iterative value is set by the value of a detected inputcorresponding to the desired frequency of the clock signal.
 3. A methodaccording to claim 1, in which the second iterative value is set by thestored trigger value, whereby the stored trigger value is at least thatin Hertz of a pre-determined interrupt frequency at which the first andsecond iterative loops are driven.
 4. A method according to claim 1, inwhich both the stored trigger value and interrupt frequency are a value2^(n), where n is a positive integer.
 5. A method according to claim 1,in which the number of iterations needed to change the first iterativevalue is determined by a stored accelerator value which is added to anaccelerator-accumulator for each iteration that the first iterativevalue and the desired frequency are not exactly equal.
 6. A methodaccording to claim 5, in which the stored trigger value and storedaccelerator value are variable.
 7. A method of controlling a steppermotor comprising the steps of:generating a clock signal having a desiredfrequency; and providing continuous acceleration between two steppingrates according to a predetermined velocity profile using the generatedclock signal, wherein said step of generating the clock signal havingthe desired frequency comprises the steps of generating a pulse eachtime a stored accumulator value is found to be greater than or equal toa stored trigger value, wherein in a first loop the stored accumulatorvalue is iteratively incremented by a first iterative value until thestored accumulator value is greater than or equal to the stored triggervalue and subsequently in a second loop the stored accumulator value isdecremented by a second iterative value until the stored accumulatorvalue is less than the stored trigger value, and wherein during eachiteration of the first loop, a current frequency of the clock signal iscompared to a desired frequency value and if the two values aredifferent, the first iterative value is corrected at a predeterminedrate over one or more subsequent iterations until the frequency of thegenerated clock signal corresponds to the detected value of the desiredfrequency.
 8. An apparatus for generating a clock signal comprising:means for detecting an input corresponding to the value of a desiredfrequency; means for generating a pulse each time a stored accumulatorvalue is found to be greater than or equal to a stored trigger value;means for controlling a first loop in which the stored accumulator valueis incremented by a first iterative value corresponding to the value ofthe desired frequency until the stored accumulator value is detected tobe greater than or equal to the stored trigger value; means forcontrolling a second loop in which the stored accumulator value isdecremented by a second iterative value until the stored accumulatorvalue is detected to be less than the stored trigger value; and, meansfor storing an accelerator value and means for storing an acceleratoraccumulator value which are used to control a rate of change of thefirst iterative value when the means for detecting the input value ofthe desired frequency detects that the value of the desired frequencyhas changed.
 9. An apparatus according to claim 8, further comprising amemory for storing the value of the desired frequency, the currentfrequency, the trigger value, the accumulator value, and the acceleratorvalue.
 10. An apparatus according to claim 8, further comprising meansfor generating an interrupt signal which controls the speed at which thefirst and second loops are executed and processing means for carryingout the functions of comparing the value of the stored accumulator valuewith the stored trigger value, incrementing or decrementing the storedaccumulator value and changing the first iterative value at apredetermined rate when the desired frequency changes.
 11. An apparatusaccording to claim 8, implemented on an integrated circuit whichcomprises a preprogrammed microprocessor.
 12. A drive systemcomprising:an apparatus for generating a clock signal, wherein saidapparatus includes means for detecting an input corresponding to thevalue of a desired frequency; means for generating a pulse each time astored accumulator value is found to be greater than or equal to astored trigger value; means for controlling a first loop in which thestored accumulator value is incremented by a first iterative valuecorresponding to the value of the desired frequency until the storedaccumulator value is detected to be greater than or equal to the storedtrigger value; means for controlling a second loop in which the storedaccumulator value is decremented by a second iterative value until thestored accumulator value is detected to be less than the stored triggervalue; and, means for storing an accelerator value and means for storingan accelerator accumulator value which are used to control a rate ofchange of the first iterative value when the means for detecting theinput value of the desired frequency detects that the value of thedesired frequency has changed; and a stepper motor, wherein the steppermotor is driven by the clock signal generated by the clock generatorapparatus.
 13. A fluid delivery apparatus comprising a plurality ofdelivery syringes, each delivery syringe comprising a syringe housingdefining a tubular passage having a fluid outlet, and a syringe plungerarranged to slide axially within the tubular passage and seal one end ofthe tubular passage, the fluid delivery apparatus further comprisingsyringe plunger drive means arranged to drive the syringe plunger alongat least part of the length of the tubular passage according to apredetermined velocity profile for the delivery syringe and dischargefluid through the fluid outlet, wherein the predetermined velocityprofile of each delivery syringe is such that, in use, a combined flowrate of fluid discharged simultaneously from the outlets of theplurality of delivery syringes is maintained substantially constant overat least a portion of the range of movement of the plurality ofplungers, and wherein the syringe plunger drive means comprises;anapparatus for generating a clock signal, wherein said apparatus includesmeans for detecting an input corresponding to the value of a desiredfrequency; means for generating a pulse each time a stored accumulatorvalue is found to be greater than or equal to a stored trigger value;means for controlling a first loop in which the stored accumulator valueis incremented by a first iterative value corresponding to the value ofthe desired frequency until the stored accumulator value is detected tobe greater than or equal to the stored trigger value; means forcontrolling a second loop in which the stored accumulator value isdecremented by a second iterative value until the stored accumulatorvalue is detected to be less than the stored trigger value; and, meansfor storing an accelerator value and means for storing an acceleratoraccumulator value which are used to control a rate of change of thefirst iterative value when the means for detecting the input value ofthe desired frequency detects that the value of the desired frequencyhas changed; and a stepper motor, wherein the stepper motor is driven bythe clock signal generated by the clock generator apparatus.